package types;

import java.util.ArrayList;

public class Vertex {
	public ArrayList<Edge> edges;	     			// edges whos source is the vertex
	public short valid_count;						// number of valid edges
	public boolean traversed;						// true if yes, false if no

	// constructor
	public Vertex ()
	{
		this.edges = new ArrayList<Edge>(); 			// ArrayList of edges.
															//(edge is this --- edge.dest w/  edge.weight distance)*/
		this.valid_count = 0;
		this.traversed = false;
	}

	public void setValidCount(short val)
	{
		this.valid_count = val;
	}
	
	public short getValidCount()
	{
		return this.valid_count;
	}
	
	// return edges that a vertex has
	public ArrayList<Edge> getEdges()
	{
		return (this.edges);
	} 
	
	
	// returns edge going to vertex e
	// consider: making this a binary search based off the edge weight
	public Edge getEdge(int e)
	{
		for(int i = 0; i < this.edges.size(); i++)
		{
			if (this.edges.get(i).getDestination() == e ) 
			{
				return this.edges.get(i);
			}
		}
		
		System.err.println("Fucked, edge not found");
		return null;
	}


}
